package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.entity.AlertData;
import com.zzyl.vo.AlertDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AlertDataMapper {
    int deleteByPrimaryKey(Long id);

    int insert(AlertData record);

    int insertSelective(AlertData record);

    AlertData selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AlertData record);

    int updateByPrimaryKey(AlertData record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table alert_data
     *
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<AlertData> list);

    Page<AlertDataVo> selectByPage(@Param("alertDataPageQueryDto") AlertDataPageQueryDto alertDataPageQueryDto, @Param("currentUserId") Long currentUserId);


    /**
     * 根据设备id，物模型id查询数据，判断5分钟内是否触发重复报警
     */
    AlertData selectByIotIdAndFunctionId(String iotId, String functionId);

    void updateBySameData(AlertData alertData);
}